package util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Util {

	public static String formatDate(Calendar date, String format) {

		SimpleDateFormat sdf = new SimpleDateFormat(format);
		return sdf.format(date.getTime());
	}
	
	public static Calendar toDate(String date, String format){
		Calendar dt = Calendar.getInstance();
		
		SimpleDateFormat sdf = new SimpleDateFormat(format);
		try {
			dt.setTime(sdf.parse(date));
		} catch (ParseException e) {
			e.printStackTrace();
		}
		
		return dt;
	}
	
}
